package com.lmc.controller;

import com.lmc.configuration.ClientConfiguration;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/Client")
public class ClientController {

    @Autowired
    private ChatClient getClient;

    @RequestMapping(value = "/ds" , produces = "text/html;charset=utf-8")
    public Flux<String> getClient(String userMessage) {
        return getClient.prompt()
                .user(userMessage)
                .advisors(new SimpleLoggerAdvisor())
                .stream()
                .content();
    }
}
